package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

public class SoundBox extends Hardware implements Comparable<SoundBox>, Serializable {

	private static final long serialVersionUID = 765447767796106217L;
	private int id;
	// 型号1
	private String model;// 音箱型号

	// 外键品牌表1
	private BRD_SOUNDBOX brand;// 音箱品牌

	// 外键码表4
	private Value type;// 音箱类型
	private Value soundTunnel;// 声道
	private Value regulationMode;// 调节方式
	private Value soundBoxMaterial;// 音箱材质

	// 一对多关系
	private Set<SB_InputInterface> sbiiSet;// 输入接口
	private Value activeOrPassive;// 有源无源
	// 次要指标13
	private double ratedPower;// 额定功率
	private String soundBoxColor;// 音箱颜色
	private String responseFrequency;// 频率响应
	private String sSize;// 产品尺寸
	private String impedence;// 阻抗
	private String sWeight;// 产品重量
	private String attachment;// 附件
	private int signalToNoiseRatio;// 信噪比
	private String CSPhone;// 客服电话
	private String qualityPolicy;// 质保政策
	private String qualityTime;// 质保时间
	private String qualityContent;// 质保详细内容

	// 管理类参数6
	private int iPrice;// 入库价格
	private int oPrice;// 出库价格
	private double performance;// 性能
	private Date inStorageTime;// 入库时间
	private String imgPath;// 图片路径
	private Value state;// 状态 //外键；{0:审核中 1:已通过}
	private double wScore;// 网友评分
	private double zScore;// 专家评分
	private int supplier;// 供货商

	private int sale;// 销售量
	private String rsv2;// 预留信息
	private String rsv3;// 预留信息

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public Set<SB_InputInterface> getSbiiSet() {
		return sbiiSet;
	}

	public void setSbiiSet(Set<SB_InputInterface> sbiiSet) {
		this.sbiiSet = sbiiSet;
	}

	public BRD_SOUNDBOX getBrand() {
		return brand;
	}

	public void setBrand(BRD_SOUNDBOX brand) {
		this.brand = brand;
	}

	public Value getType() {
		return type;
	}

	public void setType(Value type) {
		this.type = type;
	}

	public Value getSoundTunnel() {
		return soundTunnel;
	}

	public void setSoundTunnel(Value soundTunnel) {
		this.soundTunnel = soundTunnel;
	}

	public Value getRegulationMode() {
		return regulationMode;
	}

	public void setRegulationMode(Value regulationMode) {
		this.regulationMode = regulationMode;
	}

	public Value getSoundBoxMaterial() {
		return soundBoxMaterial;
	}

	public void setSoundBoxMaterial(Value soundBoxMaterial) {
		this.soundBoxMaterial = soundBoxMaterial;
	}

	public double getRatedPower() {
		return ratedPower;
	}

	public void setRatedPower(double ratedPower) {
		this.ratedPower = ratedPower;
	}

	

	public Value getActiveOrPassive() {
		return activeOrPassive;
	}

	public void setActiveOrPassive(Value activeOrPassive) {
		this.activeOrPassive = activeOrPassive;
	}

	public String getSoundBoxColor() {
		return soundBoxColor;
	}

	public void setSoundBoxColor(String soundBoxColor) {
		this.soundBoxColor = soundBoxColor;
	}

	public String getResponseFrequency() {
		return responseFrequency;
	}

	public void setResponseFrequency(String responseFrequency) {
		this.responseFrequency = responseFrequency;
	}

	public String getsSize() {
		return sSize;
	}

	public void setsSize(String sSize) {
		this.sSize = sSize;
	}

	public String getImpedence() {
		return impedence;
	}

	public void setImpedence(String impedence) {
		this.impedence = impedence;
	}

	public String getsWeight() {
		return sWeight;
	}

	public void setsWeight(String sWeight) {
		this.sWeight = sWeight;
	}

	public String getAttachment() {
		return attachment;
	}

	public void setAttachment(String attachment) {
		this.attachment = attachment;
	}

	public int getSignalToNoiseRatio() {
		return signalToNoiseRatio;
	}

	public void setSignalToNoiseRatio(int signalToNoiseRatio) {
		this.signalToNoiseRatio = signalToNoiseRatio;
	}

	public String getCSPhone() {
		return CSPhone;
	}

	public void setCSPhone(String cSPhone) {
		CSPhone = cSPhone;
	}

	public String getQualityPolicy() {
		return qualityPolicy;
	}

	public void setQualityPolicy(String qualityPolicy) {
		this.qualityPolicy = qualityPolicy;
	}

	public String getQualityTime() {
		return qualityTime;
	}

	public void setQualityTime(String qualityTime) {
		this.qualityTime = qualityTime;
	}

	public String getQualityContent() {
		return qualityContent;
	}

	public void setQualityContent(String qualityContent) {
		this.qualityContent = qualityContent;
	}

	public int getiPrice() {
		return iPrice;
	}

	public void setiPrice(int iPrice) {
		this.iPrice = iPrice;
	}

	public int getoPrice() {
		return oPrice;
	}

	public void setoPrice(int oPrice) {
		this.oPrice = oPrice;
	}

	public double getPerformance() {
		return performance;
	}

	public void setPerformance(double performance) {
		this.performance = performance;
	}

	public Date getInStorageTime() {
		return inStorageTime;
	}

	public void setInStorageTime(Date inStorageTime) {
		this.inStorageTime = inStorageTime;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public Value getState() {
		return state;
	}

	public void setState(Value state) {
		this.state = state;
	}

	public double getwScore() {
		return wScore;
	}

	public void setwScore(double wScore) {
		this.wScore = wScore;
	}

	public double getzScore() {
		return zScore;
	}

	public void setzScore(double zScore) {
		this.zScore = zScore;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSupplier() {
		return supplier;
	}

	public void setSupplier(int supplier) {
		this.supplier = supplier;
	}

	public int getSale() {
		return sale;
	}

	public void setSale(int sale) {
		this.sale = sale;
	}

	public String getRsv2() {
		return rsv2;
	}

	public void setRsv2(String rsv2) {
		this.rsv2 = rsv2;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}

	@Override
	public int compareTo(SoundBox o) {

		Date now = new Date();

		// this的热度
		long gap = now.getTime() - inStorageTime.getTime();
		int gapDay = (int) (gap / (24 * 3600 * 1000));

		double nowHot = sale / gapDay;

		// 参数的hot
		long oGap = now.getTime() - o.getInStorageTime().getTime();
		int oGapDay = (int) (oGap / (24 * 3600 * 1000)) + 1;

		double oHot = o.getSale() / oGapDay;

		// 降序排列
		if (nowHot > oHot)
			return -1;
		else if (nowHot == oHot)
			return 0;
		else
			return 1;
	}

}
